package com.huang.controller;

import com.huang.domain.ResultObject;
import com.huang.entity.User;
import com.huang.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 黄自祥
 * @date 2022/05/03 18:06
 * @Description:
 */
@RestController
public class LoginController {

    @Autowired
    LoginService loginService;

    @PostMapping("/user/login")
    public ResultObject login(@RequestBody User user){

        return loginService.login(user);
    }
    // 退出登录
   @GetMapping("/user/logout")
    public ResultObject logout(){
       loginService.logout();
        return ResultObject.success("退出成功");
    }


}
